#ifndef PFILELISTTABLEMODEL_H
#define PFILELISTTABLEMODEL_H

#include <QAbstractTableModel>
#include "pfilelist.h"

class PFileListTableModel : public QAbstractTableModel
{
    Q_OBJECT
public:
    PFileListTableModel( PFileList *file_list , QObject *parent = 0 );

    void append ( ExaModuleObj m );

    // Obbligatorio per modello sola lettura
    int rowCount(const QModelIndex &parent = QModelIndex()) const;
    int columnCount(const QModelIndex &parent /*= QModelIndex()*/) const;
    QVariant data(const QModelIndex &index, int role) const; // gestisce l'inserimento dei dati e l'estrazione
    QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;

    // Obbligatorio per modello resizeble. QModelIndex non serve nel caso di tabelle
    bool insertRows(int position, int rows, const QModelIndex &parent=QModelIndex());
    bool removeRows(int position, int rows, const QModelIndex &parent=QModelIndex());

    // Obbligatorio per modello editabile
    bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole);

    Qt::ItemFlags flags(const QModelIndex &index) const;

    // Per aggiornare la vista quando il modello cambia (WhenExternalDataChange)
    void updateWEDChange(void);

    void updateWEDChangeWReset(void);

signals:

private:
    PFileList *m_file_list;
};

#endif // PFILELISTTABLEMODEL_H
